<template>
  <div>
    <Header></Header>
    <!-- 路由组件出口的地方 -->
    <router-view></router-view>
    <!-- 在Home、Search显示，在Login、Register隐藏 -->
    <Footer v-show="$route.meta.show"></Footer>
  </div>
</template>

<script>
// 引入Header组件
import Header from './components/Header'
import Footer from './components/Footer'
import { mapState } from 'vuex'

export default {
  name: 'App',
  components: {
    Header,
    Footer,
  },
  mounted() {
    // 派发一个action||获取商品分类的三节列表数据
    this.$store.dispatch('getCategoryList')
  },
  computed: {
    ...mapState({
      categoryList: (state) => state.home.categoryList,
    }),
  },
}
</script>

<style>
</style>
